package com.minimalist.common.feign.client.lindi;

import com.minimalist.common.config.mybatis.bo.PageResp;
import com.minimalist.common.entity.lindi.vo.activity.LindiActivityQueryVO;
import com.minimalist.common.entity.lindi.vo.activity.LindiActivityVO;
import com.minimalist.common.feign.config.FeignConfig;
import com.minimalist.common.feign.fallback.lindi.LindiActivityFeignClientFallbackFactory;
import com.minimalist.common.response.R;
import com.minimalist.common.utils.Add;
import com.minimalist.common.utils.Update;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import jakarta.validation.constraints.NotNull;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * 林地活动 Feign 客户端
 *
 * @author minimalist
 */
@FeignClient(name = "minimalist-lindi"
        , contextId = "lindiActivityFeignClient"
        , path = "/minimalist/lindi/activity"
        , configuration = FeignConfig.class
        , fallbackFactory = LindiActivityFeignClientFallbackFactory.class)
public interface LindiActivityFeignClient{

    /**
     * 添加活动
     *
     * @param activityVO 活动信息
     * @return 响应结果
     */
    @PostMapping("/addActivity")
    @Operation(summary = "添加活动")
    R<?> addActivity(@RequestBody @Validated(Add.class) LindiActivityVO activityVO);

    /**
     * 修改活动
     *
     * @param activityVO 活动信息
     * @return 响应结果
     */
    @PutMapping("/updateActivityByActivityId")
    @Operation(summary = "修改活动")
    R<?> updateActivityByActivityId(@RequestBody @Validated(Update.class) LindiActivityVO activityVO);

    /**
     * 删除活动
     *
     * @param activityId 活动ID
     * @return 响应结果
     */
    @DeleteMapping("/deleteActivityByActivityId")
    @Operation(summary = "删除活动 -> 根据活动ID删除")
    R<?> deleteActivityByActivityId(
            @RequestParam("activityId")
            @NotNull(message = "活动ID不能为空")
            @Parameter(name = "activityId", required = true, description = "活动ID")
            Long activityId);

    /**
     * 获取活动详情
     *
     * @param activityId 活动ID
     * @return 活动详情
     */
    @GetMapping("/getActivityByActivityId/{activityId}")
    @Operation(summary = "根据活动ID查询活动")
    R<LindiActivityVO> getActivityByActivityId(
            @PathVariable("activityId")
            @NotNull(message = "活动ID不能为空")
            @Parameter(name = "activityId", description = "活动ID", required = true)
            Long activityId);

    /**
     * 分页查询活动列表
     *
     * @param queryVO 查询条件
     * @return 活动列表
     */
    @GetMapping("/getPageActivityList")
    @Operation(summary = "查询活动列表(分页)")
    R<PageResp<LindiActivityVO>> getPageActivityList(@RequestBody LindiActivityQueryVO queryVO);
}